﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Basmus.ReadWrite;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Basmus.Tests.ReadWrite
{
    [TestClass]
    public class GuidReaderWriterTest
    {
        [TestMethod]
        public void ReadSuccessTest()
        {
            var guid = Guid.NewGuid();
            var target = new GuidReaderWriter();
            var expected = ReadResult<Guid>.Success(guid);

            var actual = target.Read(guid.ToString());

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void ReadErrorTest()
        {
            var target = new GuidReaderWriter();
            var expected = ReadResult<Guid>.Error();

            var actual = target.Read("gsdfg");

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void WriteTest()
        {
            var guid = Guid.NewGuid();
            var target = new GuidReaderWriter();
            var expected = guid.ToString();

            var actual = target.Write(guid);
            
            Assert.AreEqual(expected, actual);
        }
    }
}
